<template>
  <div class="table-page-search-wrapper">
    <el-form :model="searchForm" ref="searchForm" label-width="100px" class="demo-ruleForm">
      <el-row :gutter="10">
        <el-col :md="8" :sm="12" :xs="24">
          <el-form-item label="选择日期:">
            <el-date-picker
              v-model="riqi"
              type="daterange"
              @change="riqiChange"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              style="width:100%"
               :default-time="['00:00:00', '23:59:59']"
            ></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :md="5" :sm="12" :xs="24">
          <el-form-item label="销售渠道:">
            <el-select v-model="searchForm.saleScope" placeholder="请选择销售渠道" style="width:100%">
              <el-option
                v-for="item in qudaoList"
                :key="item.value"
                :value="item.value"
                :label="item.label"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :md="8" :sm="12" :xs="24">
          <el-form-item label="门店:">
            <el-select
              v-model="searchForm.shopId"
              filterable
              placeholder="请选择门店"
              style="width:100%"
            >
              <el-option
                v-for="item in mendianList"
                :key="item.value"
                :value="item.value"
                :label="item.label"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :md="8" :sm="12" :xs="24">
          <el-form-item label="地区:">
            <el-input v-model="searchForm.areaName" placeholder="请输入地区"></el-input>
          </el-form-item>
        </el-col>
        <el-col :md="6" :sm="12" :xs="24">
          <div style="margin-left:30px">
            <el-button type="primary" icon="el-icon-search" @click="searchAction()">查询</el-button>
            <el-button icon="el-icon-refresh" @click="resetSearch()" style="margin-left: 8px;">重置</el-button>
          </div>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
<script>
import { shopinfopage } from "@/api/shop/dataReport/storeData.js";
export default {
  name: "search",
  props: ["keyName"],
  data() {
    return {
      statuslistt: [], //商品类目
      mendianList: [],
      dishiList: [],
      riqi: [],
      qudaoList: [
        {
          label: "全部渠道",
          value: "00",
        },
        {
          label: "线上",
          value: "01",
        },
        {
          label: "线下",
          value: "02",
        },
      ], //销售渠道
      shangpinList: [], //商品类目
      searchForm: {},
    };
  },
  mounted() {
    this.shopinfopageFn();
  },
  methods: {
    searchAction() {
      //执行搜索
      this.$emit("search");
    },
    resetSearch() {
      this.searchForm = {};
      this.riqi = [];
      this.$emit("resetSearch");
    },
    getSearchForm() {
      //获取高级搜索条件
      return {
        ...this.searchForm,
      };
    },
    riqiChange(e) {
      this.searchForm.beginTime = this.formDate(e[0]);
      this.searchForm.endTime = this.formDate(e[1]);
    },
    shopinfopageFn() {
      shopinfopage().then((val) => {
        let data = val.data.data;
        this.mendianList = data.records.map((item) => {
          return {
            label: item.shopName,
            value: item.shopId,
          };
        });
      });
    },
  },
};
</script>


<style lang="less">
</style>>
